<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container"> 
      <form enctype="multipart/form-data" method="post" id="frm">
          <div class="table">
           <div class="toolbars">
                <li class="toolbar"><a id="btnSaveAll" href="{$Url}Add"  title="添加管理员分组" target="_self">添加管理员组</a></li>
                <li class="toolbar"><a id="selectall" onclick="CheckAll()"  title="全选">全选</a></li>
                <li class="toolbar"><a id="del" onclick="BatchDel()" title="批量删除">删除</a></li>
            </div>
            <table class="datatable" id="datatable">
                <tr>
                    <th width="45px"  nowrap="nowrap">选中</th>
                    <th width="90px" >管理员分组ID</th>
                    <th width="140px" >管理员分组名称</th> 
                    <th width="90px" >管理员数量</th>
                    <th>管理员分组备注</th> 
                    <th width="90px" >属性</th>
                    <th width="150px" >操作</th>
                </tr>
                <volist name="AdminGroup" id="ag">
                    <tr id="tr{$ag.AdminGroupID}">
                    <td><eq name="ag.AdminCount" value="0"><input class="checkrow" type="checkbox" name="AdminGroupID[]" value="{$ag.AdminGroupID}" /></eq></td>
                    <td>{$ag.AdminGroupID}</td>
                    <td><b>{$ag.AdminGroupName}</b></td>
                    <td style="color:blue;">{$ag.AdminCount}</td>
                    <td style="text-align:left;">{$ag.AdminGroupRemark}</td>
                    <td><eq name="ag.IsSystem" value="1"><span style="color:#F00">系统</span><else/><span style="color:green">自定义</span></eq></td>
                    
                    <td class="operator">
                        <a style="float:left" href="{$Url}Modify/AdminGroupID/{$ag.AdminGroupID}" id="btnEdit">修改</a>
                        <eq name="ag.IsSystem" value="0">
                            <eq name="ag.AdminCount" value="0">
                                <div class="btn-sep"></div>
                                <a style="float:left" onclick="Del({$ag.AdminGroupID})" class="btnDel">删除</a>
                            </eq>
                        </eq>
                    </td>
                    </tr>
                </volist>                                
            </table>
             <div class="tfoot">
                  <div id="notice"><b>说明：</b><span class="notice-item">不能删除属性为系统的管理组</span></div>
             </div>
        </div>
    </form>
</div>
</body>
</html>
<script type="text/javascript">
function Del(id){
	$.confirm("{$Think.lang.DeleteTip}", function () {
		url = "{$Url}Del/AdminGroupID/"+id;
		$.get(url, {}, DelComplete, "json");
	}, function () {
		return true;
	});
}

//回调函数
function DelComplete(data, textStatus){
	if (data.status == 1){
		$(data.data).css("display","none");
	}else{ //删除失败
		ErrorBox(data.info);
	}
}

//批量删除
function BatchDel(){
	//var arrChk = $("input[name='InfoID[]'][checked]"); //在高速浏览器长度总是返回0
	var arrChk = $("input[name='AdminGroupID[]']");
	var n = 0;
	for(var i = 0; i < arrChk.length; i++){
		if(arrChk[i].checked) n++;
	}
	
	if( n == 0 ) {
		WarnBox("{$Think.lang.CheckDeleteTip}");
		return;
	}
	
	$.confirm("{$Think.lang.DeleteTip}", function () {
		$('#frm').attr("action", "{$Url}batchDel");
		$('#frm').submit();
	}, function () {
		return true;
	});
}
</script>